<?php
class EditUser extends Action {
	/*
	 * (non-PHPdoc) @see Action::execute()
	 */
	public function execute($params) {
		check_login ( ADMIN_LOGIN_PAGE );
		$uid = irqst ( 'uid' );		
		if (empty ( $uid )) {
			$data ['page_tip_info'] = "<strong>出错啦!</strong>uid为空，系统无法加载对应用户账户。";
		} else {
			$user = sess_del ( 'user_info', false );
			if (! $user) {
				$userModel = new CoreUserModel ();
				$user = $userModel->read ( $uid );
			}
			if ($user == false) {
				$data ['page_tip_info'] = "<strong>出错啦!</strong>uid为{$uid}的用户不存在。";
			} else {
				$data = $user;
				$data ['user'] = $user;
				$data ['page_tip_info'] = sess_del ( 'page_tip_info' );
			}
		}
		$data['alert_cls'] = 1 == irqst('suc',0)?'alert-success':'alert-error';
		$data ['error'] = sess_del ( 'user_error', array () );
		$data ['error_cls'] = ModelValidator::getErrorCls ( $data ['error'] );
		return new SmartyView ( $data, 'users/EditUser' );
	}
}